package com.example.nick.bodyapplication

import android.os.Bundle
import android.transition.TransitionManager
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.viewmodel.compose.viewModel
import com.example.nick.bodyapplication.databinding.ActivityWeekDayBinding

class WeekDayActivity : AppCompatActivity() {

    lateinit var viewBinding: ActivityWeekDayBinding
    var weekDayArr = Array(size = 7, init = { Array(24, init = { 0 }) })

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        viewBinding = ActivityWeekDayBinding.inflate(layoutInflater)
        setContentView(viewBinding.root)
        viewBinding.weekDayTab.scrollView = viewBinding.scrollView

//        viewBinding.areaHideTop.postDelayed( {
//            TransitionManager.beginDelayedTransition(viewBinding.root)
//            viewBinding.areaHideTop.visibility = View.GONE
//        }, 2000)
    }

    fun onUpdate(view: View) {
        for (i in 0..6) {
            for (j in 0..23) {
                weekDayArr[i][j] = if (i % 2 == 0 && j % 2 == 0) 1 else 0
            }
        }
        viewBinding.weekDayTab.updateArrays(weekDayArr)
    }

    fun onCleanArr(view: View) {
        for (i in 0..6) {
            for (j in 0..23) {
                weekDayArr[i][j] = 0
            }
        }
        viewBinding.weekDayTab.updateArrays(weekDayArr)
    }

    fun onFillArr(view: View) {
        for (i in 0..6) {
            for (j in 0..23) {
                weekDayArr[i][j] = 1
            }
        }
        viewBinding.weekDayTab.updateArrays(weekDayArr)
    }
}